class ListNode:
    def __init__(self, val, next=None):
        self.val = val
        self.next = next

    def __repr__(self):
        return str(self.val)+"->"+repr(self.next)

def removeNth(l: ListNode, n: int):
    dummyHead = ListNode(0, l)
    f = s = dummyHead
    for i in range(n):
        f = f.next

    while f:
        f = f.next
        s = s.next

    s.next = s.next.next

    return dummyHead.next

a1 = ListNode(2)
a2 = ListNode(4)
a3 = ListNode(3)
a4 = ListNode(7)

a1.next = a2
a2.next = a3
a3.next = a4

print(a1)
removeNth(a1, 2)
print(a1)
